﻿using NHibernate;

namespace Golf.DataLayer
{
    using Core;

    public class CourseRepository : RepositoryBase, ICourseRepository
    {
        public Course Get(int id)
        {
            using (ISession session = SessionFactory.OpenSession())
            {
                return session.Get<Course>(id);
            }
        }

        public void Save(Course course)
        {
            using (ISession session = SessionFactory.OpenSession())
            {
                session.SaveOrUpdate(course);
                session.Flush();
            }
        }
    }
}
